package com.uyaer.wheel.common
{
	import flash.net.SharedObject;

	public class UserData
	{
		private static var m_instance:UserData;
		
		public var maxStarCount:uint = 0;
		
		/**
		 *星星数量 
		 */		
		public var starCount:uint = 0;
		/**
		 *等级 
		 */		
		public var level:uint = 1;
		
		private var shared:SharedObject;
		
		public function UserData()
		{
			shared = SharedObject.getLocal("userdata");
		}
		
		public static function get me():UserData{
			return m_instance ||= new UserData();
		}
		
		public function init():void{
			starCount = 0;
			level = 1;
		}
		
		public function read():void{
			var data:Object = shared.data.userdata;
			if(data){
				maxStarCount = data.maxStarCount;
			}else{
				maxStarCount = 0;
			}
		}
		
		public function save():void{
			var data:Object = new Object();
			data.maxStarCount = maxStarCount;
			shared.data.userdata = data;
		}
	}
}